using System;
using System.Web;
using NCommon.Data;

namespace Roommate.Infrastructure.Persistence
{
  
    public class UnitOfWorkModule : IHttpModule
    {

        public void Init(HttpApplication context)
        {

            context.BeginRequest += BeginRequest;

            context.EndRequest += EndRequest;

        }



        private void BeginRequest(object sender, EventArgs e)
        {

            UnitOfWork.Start();

        }



        private void EndRequest(object sender, EventArgs e)
        {
           UnitOfWork.Finish(true);
        }



        public void Dispose()
        {

            

        }

    } 

}